import { isMobileTerminal } from '@/utils/flexible.js'

// 快速访问
export default {
  categorys: (state) => state.category.categorys,
  themeType: (state) => state.theme.themeType,
  /**
   * category选中项
   */
  currentCategory: (state) => state.app.currentCategory,
  /**
   * category选中项下标
   */
  currentCategoryIndex(state, getters) {
    const result = getters.categorys.findIndex((item) => {
      return item.id === getters.currentCategory.id
    })
    return result
  },
  /**
   * 搜索历史
   */
  historys: (state) => state.search.historys,
  searchText: (state) => state.app.searchText,
  token: (state) => state.user.token,
  userInfo: (state) => state.user.userInfo,
  routerType: (state) => {
    // pc端下永远没有跳转动画
    if (!isMobileTerminal) {
      return 'none'
    }
    return state.app.routerType
  }
}
